package sctu.edu.java.year2016.team06.chenqiang.day20160522.chapter6_1;

/**
 * Created by XQ on 2016/5/22.
 * 在项目中创建Number类，判断字符“mingrikejibu1”中i字符出现的次数，并输出。
 */

import java.util.regex.Pattern;

public class Number {
    public static void main(String[] args) {
        String c = new String("mingrikejibu");
        int j = 0;
        for (int m = 0; m < c.length(); m++) {
            boolean matches = Pattern.matches("i", "" + c.charAt(m));
            if (matches) {
                j++;
            }
        }
        System.out.println("mingrikejibu中字符“i”出现了几次：" + j + "次");
    }
}
